<!DOCTYPE html>
<html>
<head>
    <style>
        div {
            width: 50px;
            height: 50px;
        }
        #container {
            overflow: scroll;
            width: 100px;
            height: 100px;
            border: 1px solid black;
        } 
        iframe {
            padding: 5px;
            border: 1px solid black;
        }
        .scrolled {
            position: relative;
            margin: 10px;
            background-color: green;
        }
        .float {
            float: right;
            position: relative;
            margin: 10px;
            background-color: green;
        }
        .fixed {
            position: fixed;
            top: 200px;
            left: 200px;
            margin: 10px;
            background-color: blue;
        }
        .neg-z-order {
            z-index: -1;
        }
        .stacking-context {
            position: relative;
            z-index: 1;
        }
    </style>
    <script>
        if (window.testRunner)
            testRunner.dumpAsText(false);

        if (window.internals) {
            internals.settings.setPreferCompositingToLCDTextEnabled(true);
        }
    </script>
</head>
<body>
    <div id="container">
        <div class="float">
            <!-- 
            This iframe should not have a scroll parent because its
            parent (class="float") has a scroll parent and this would
            be redundant.
            -->
            <iframe src="resources/composited-subframe.html"></iframe>
        </div>
        <div class="float stacking-context">
            <!-- 
            This iframe should not have a scroll parent because its
            parent (class="float") has a scroll parent and this would
            be redundant.
            -->
            <iframe class="stacking-context" src="resources/composited-subframe.html"></iframe>
        </div>
        <!--
        The problem here is that this iframe thinks it has a scroll parent, even though
        it would totally be parented under its scroll parent since it's normal flow.
        This is one of those rare cases where we have a composited layer in the normal
        flow list.
        -->
        <iframe src="resources/composited-subframe.html"></iframe>
        <div class="fixed neg-z-order"></div>
        <div class="scrolled neg-z-order"></div>
        <div class="scrolled"></div>
        <div class="scrolled"></div>
        <div class="scrolled"></div>
    </div>
    <pre id="layers">Pass -- this test passes if it does not crash.</pre>
</body>
</html>
